﻿// -----------------------------------------------------------------------
// <copyright file="InfoMessage.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.User
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    /// <summary>
    /// Custom information dialog
    /// </summary>
    internal partial class InfoMessage : Form
    {
        /// <summary>Stores a value indicating if the user selected Yes button</summary>
        private bool yes;

        /// <summary>
        /// Initializes a new instance of the InfoMessage class.
        /// </summary>
        internal InfoMessage()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Sets the message title
        /// </summary>
        internal string MessageTitle
        {
            set
            {
                this.Text = value;
            }
        }

        /// <summary>
        /// Sets the StackTrace info
        /// </summary>
        internal string MessageText
        {
            set
            {
                this.lblMessageText.Text = value;
            }
        }

        /// <summary>
        /// Sets a value indicating whether Yes/No buttons are shown
        /// </summary>
        internal bool ShowYesNoButtons
        {
            set
            {
                this.buttonYes.Visible = value;
                this.buttonNo.Visible = value;
                this.buttonOk.Visible = !value;
            }
        }

        /// <summary>
        /// Gets the user choice
        /// </summary>
        /// <returns>Returns the user choice</returns>
        internal bool UserChoice()
        {
            return this.yes;
        }

        /// <summary>
        /// Occurs when the user click Yes button
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event args</param>
        private void ButtonYes_Click(object sender, EventArgs e)
        {
            this.yes = true;
            this.Close();
        }
        
        /// <summary>
        /// Occurs when the user click No button
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event args</param>
        private void ButtonNo_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// Occurs when the user click OK button
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event args</param>
        private void ButtonOk_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
